#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

class Solution {
public:
    bool isPowerOfThree(int n) {
        if(n==0){
            return false;
        }
        double a = log10(n)/log10(3);
        return a==floor(a);
    }
};
